<!DOCTYPE html>

<head>
  <title>公会战设置</title>
  <meta name='viewport' content='width=480' charset="utf-8" />
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.0/index.js"></script>
  <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.0/theme-chalk/index.css">
</head>

<body>
  <div id="app">
    <el-page-header @back="location='../'" :content="groupData.group_name + ' - 公会战设置'"></el-page-header>
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">面板</el-menu-item>
      <el-menu-item index="2">预约</el-menu-item>
      <el-menu-item index="3">查刀</el-menu-item>
      <el-menu-item index="4">统计</el-menu-item>
      <el-menu-item index="5">我的</el-menu-item>
    </el-menu>
    <h1 style="text-align:center">设置</h1>
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="游戏区服">
        <el-select v-model="form.game_server">
          <el-option label="日服" value="jp"></el-option>
          <el-option label="韩服" value="kr"></el-option>
          <el-option label="台服" value="tw"></el-option>
          <el-option label="国服" value="cn"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="隐私设置">
        <el-checkbox v-model="form.privacy.allow_guest">出刀表无需登录</el-checkbox>
        <el-checkbox v-model="form.privacy.allow_statistics_api">允许api获取数据</el-checkbox>
      </el-form-item>
      <el-form-item label="通知到群">
        <el-checkbox v-model="form.notify.challenge">伤害上报</el-checkbox>
        <el-checkbox v-model="form.notify.undo">撤销上报</el-checkbox>
        <el-checkbox v-model="form.notify.apply">申请出刀</el-checkbox>
        <el-checkbox v-model="form.notify.cancelapply">取消申请</el-checkbox>
        <el-checkbox v-model="form.notify.subscribe">预约boss</el-checkbox>
        <el-checkbox v-model="form.notify.cancelsubscribe">取消预约</el-checkbox>
        <el-checkbox v-model="form.notify.suspend">挂树</el-checkbox>
        <el-checkbox v-model="form.notify.cancelsuspend">取消挂树</el-checkbox>
        <el-checkbox v-model="form.notify.modify">修改状态</el-checkbox>
        <el-checkbox v-model="form.notify.sl">使用SL</el-checkbox>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submit">确定</el-button>
        <el-button @click="location='..'">返回</el-button>
      </el-form-item>
      <el-form-item>
        现在档案编号：[[ battle_id ]]<br>
        <el-button type="primary" @click="export_data" icon="el-icon-download" size="mini">导出数据</el-button>
        {#- <el-button type="primary" @click="new_data_slot" icon="el-icon-document-add" size="mini">新建档案</el-button> -#}
        <el-button type="primary" @click="get_data_slot_record_count();switchVisible = true" icon="el-icon-receiving" size="mini">切换档案</el-button>
        <el-dialog title="切换档案" :visible.sync="switchVisible">
          <el-alert title="你可以切换存档编号，以记录不同期的公会战数据，这样能保留历史数据，也可以在统计里随时查看" type="info" close-text="知道了"></el-alert>
          <ul>
            <li v-for="item in data_slot_record_count">
              [[ item.battle_id ]]号存档：[[ item.record_count ]]条记录
            </li>
          </ul>
          <el-form>
            <el-form-item label="切换至" label-width="120">
              <el-input-number v-model="battle_id" :min="0"></el-input-number>
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="switchVisible = false">取消</el-button>
            <el-button type="danger" @click="switch_data_slot">切换</el-button>
          </span>
        </el-dialog>
        <el-button type="danger" @click="confirmVisible = true" icon="el-icon-delete" size="mini">删除数据</el-button>
        <el-dialog title="警告" :visible.sync="confirmVisible">
          <p>此操作会删除 [[ battle_id ]] 号存档中所有数据</p>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="confirmVisible = false">取消</el-button>
            <el-button type="danger" @click="clear_data_slot">确定</el-button>
          </span>
        </el-dialog>
      </el-form-item>
    </el-form>
  </div>
  <el-footer style="text-align: center;position: fixed;bottom: -10px;left: 50%;transform: translate(-50%, -50%);background-color: #66b1ff;color: #ffffff;
width: 100%;font-size:15px;">
    powered by <a href="https://github.com/pcrbot/yobot" style="text-decoration:none;color: #ffffff;">yobot</a>
  </el-footer>
</body>
<script>var csrf_token = "{{ session['csrf_token'] }}";</script>
<script src="{{ url_for('yobot_static', filename='clan/setting.js') }}"></script>

</html>